<template>
  <view class="news-page-container">
    <!-- 1. 顶部导航栏 -->
    <view class="nav-bar customHeader" @click="navSearch">
      <view class="nav-left">
        <image
          class="nav-icon"
          src="https://cphimg.leyoo888.com/dev/upload/supplier/2025-08-24/1756021517435.png"
        />
        <text class="nav-title">手机游戏</text>
      </view>
      <image
        class="nav-search-icon"
        src="https://cphimg.leyoo888.com/dev/upload/supplier/2025-08-24/1756021522290.png"
      />
    </view>

    <!-- 2. 分类标签栏 -->
    <view class="category-tabs">
      <text
        v-for="tab in categories"
        :key="tab"
        :class="['tab-item', { active: activeTab === tab }]"
        @click="cateTabs(tab)"
      >
        {{ tab }}
      </text>
    </view>

    <!-- 3. 新闻列表 -->
    <scroll-view
      class="news-list"
      scroll-y="true"
      @scrolltolower="onScrollToLower"
      :lower-threshold="100"
      ref="scrollViewRef"
    >
      <view
        class="news-item"
        v-for="(item, index) in filteredNews"
        :key="index"
        @click="navWeb(item)"
      >
        <image
          class="news-thumbnail"
          :src="item.image"
          mode="aspectFill"
        ></image>
        <view class="news-content">
          <text class="news-title">{{ item.title }}</text>
        </view>
      </view>
    </scroll-view>

    <!-- 底部自定义tabbar -->
    <custom-tabbar
      :currentIndex="currentTabIndex"
      @tabChange="handleTabChange"
    />
    <view class="tabbar-placeholder"></view>
  </view>
</template>

<script setup>
import CustomTabbar from "@/components/tabbar.vue";
import { ref, computed } from "vue";
import { tabbarTo } from "@/utils/helper";
import { showToast } from "@/utils/helper";

const currentTabIndex = ref(2); // 假设新闻页在tabbar是第3个
const activeTab = ref("试玩");
const categories = ref([
  "试玩",
  "关注栏目",
  "手游资讯",
  "枪战资讯",
  "原神",
  "潜力资讯",
]);

const allNews = {
  试玩: [
    {
      title: "王者荣耀新赛季QV互通,支持跨平台加好友 + 邀请对局",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82c986395c46666c4.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F9a361281294ea355045df8aa544172ed&check=8a111be950b5f330&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "魔兽争霸3加持吸血光环的天灾骨钟常被卖商店,原因有四",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c890d77410e1f2be5b.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F1b7a84cdea30e55965aa6cfaa7003893&check=5ee4d444737bdd49&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "X惊现,超级马里奥,40周年纪念号 玩家热议分析真假",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c89c2c8c3f8275647f.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fd519899c4a7d0f27046dc4c802007506&check=1465ee6a2ae47594&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "《原神》后，《最终幻想14》恐成下个退出索尼PS4 平台的热门游戏",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c814c251359192e8d1.jpg",
      url: "https://www.360kuai.com/9c8aa2a940c61afdc?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《原神》原声专辑再发力，游戏成古典乐桥梁？”",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c80785d213ffbf8d9d.jpg",
      url: "https://www.360kuai.com/948a0377b6a03a60b?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《王者荣耀》诡秘之主联动皮肤全解析，元歌新皮肤是否值得入手？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c33019b3b77eae232b737.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fcdffa62c272a422c547f2698af8a49f7&check=a59bc2103974fc85&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "原神基尼奇装备攻略大揭秘！学会这些轻松逆袭游戏战场",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c86933f0920089a8b7.jpg",
      url: "https://www.360kuai.com/96e653c87e04a984b?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "王者冷知识：等级框其实也有不同状态？这四个99%玩家都认不全",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c3301b7c53e131f30aedc.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F6fa3ec5ea7a3558e46365531259812ce&check=1271ddbf4b099ad3&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "王者敌方秒选不知火舞咋办？放弃女娲干将，她天克火舞",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c89fd75cdb2a13a305.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F926bff3cbd8ec350d63dba7af6ce0892&check=a90527290248efbf&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "2025科隆游戏展：腾讯《王者荣耀世界》发布全新预告",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8fbf4eed5e1d8952b.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fe0377e252a413db83e689b622d439c97&check=35db353a1b28b880&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "王者荣耀新赛季QV互通,支持跨平台加好友 + 邀请对局",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82c986395c46666c4.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F9a361281294ea355045df8aa544172ed&check=8a111be950b5f330&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "魔兽争霸3加持吸血光环的天灾骨钟常被卖商店,原因有四",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c890d77410e1f2be5b.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F1b7a84cdea30e55965aa6cfaa7003893&check=5ee4d444737bdd49&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "《一人之下》角色实力大比拼,谁才是最强",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c811e3583ac69a6fde.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F7b2bfef313c459f6d8fc1e6ae73aceb2&check=5ab7ff2d017e046f&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "诸葛亮和周瑜组队玩王者荣耀,一个足智多谋,一个才华横溢,能一路冲上.",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c3301baebfd6ac514b026.png",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F43ebdeb9a8ae6f153668586f53c71ecc&check=bc57e7a41d6c1722&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "玩家动手创造世界！原神全新玩法千星奇域曝光，自由度拉满”",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8fad21109a24808e9.jpg",
      url: "https://www.360kuai.com/930727451b01b3658?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
  ],
  关注栏目: [
    {
      title: "王者荣耀新手必知！从青铜到王者的入门精通攻略靠谱吗？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82afc99aa69939fb0.jpg",
      url: "https://www.360kuai.com/9c289ce5910355627?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "王者荣耀进阶必看！从入门到精通的全攻略秘籍有哪些？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c844b27163a34dc481.jpg",
      url: "https://www.360kuai.com/9c79b1efc018a1202?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "王者攻略：如何应对刘邦上单？避开吕布和亚连，选他克敌制胜",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8ae6efa3718b57580.jpg",
      url: "https://www.360kuai.com/97339f70d6daf638d?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "王者攻略：如何巧妙应对“瑶马组合”？揭秘东皇、墨子之外的高效解法！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c86f39e0ed5ff028b1.jpg",
      url: "https://www.360kuai.com/9ce514bbb0ff49706?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "蛋仔游戏热门角色，谁才是最强？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8213ec5b0330afcbe.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Ff893f6432cd44218bb5f1ebad9208f61&check=1a59260a632b0af0&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "王者攻略：如何应对敌方守约射手？放弃后羿，避免使用马可波罗，这个英雄天然克制守约",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c80e2c57a367e452ee.jpg",
      url: "https://www.360kuai.com/9a56910cfd0c8924a?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "王者荣耀法师攻略：这3个细节决定胜负！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82efd8cd2920ff2ee.jpg",
      url: "https://www.360kuai.com/92491faab6dde3dc0?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "还在乱选英雄？王者阵容搭配攻略来了！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8f496fce795f29003.jpg",
      url: "https://www.360kuai.com/91779b7ffe646f479?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66"
    },
    {
      title: "王者荣耀战士出装攻略，3招教你打爆全场",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c87c4c03c27dbc7792.jpg",
      url: "https://www.360kuai.com/9ef6c70db791f7a3f?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "与好友一起撸猫！火爆放置游戏邦戈猫多人模式更新",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c857579cea61d2f4e7.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Ffc2f9ee0d668692b2e5e513877a1fc7d&check=9c90f0376541a31a&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
  ],
  手游资讯: [
    {
      title: "腾讯《QQ飞车》手游鸿蒙HarmonyOS NEXT版正式服预计9月初上线",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c878e5099b4e58518c.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F85073b1090930d91a9a20916f035cede&check=cf54a8cb61159660&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "网易《逆水寒》手游最新全景光追效果亮相，联合英伟达打造",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c85a001a860da973c7.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F3e9667f2f466dfc254c793858fa2b2c0&check=e6d07ef2bf1a1529&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游“桐人专属黑剑”爆火，全民免费抽，比最贵装扮还帅",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8eda8e35d1471fbb0.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F7ed8119b8c0749d1f93ed2c591bbc7ee&check=8d4002656c2c4bdb&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "不做就掉队？头部手游都在靠这一设计提升营收",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82ba622f6cc1b4486.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fb8becdea6379aeb53bfec4d49dddfffb&check=99aa038276e63efb&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游最欧玩家诞生，免费周本刷出90000抗魔引众人看懵",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8b76e9d517601c1ce.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F1f2d3170dd078b21c4f440deec9c5dca&check=4085cb3748d28d23&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "诛仙2手游、华为夏日游戏节暴击预警！国产双巨头首次线下联动",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c33015dc389139a99370b.png",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Faab9ab8726d7eb527d2d07f83f0c3953&check=96386712e57cfb5b&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游1000天在线奖励火了，策划特奖这类玩家领不到",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c81f2ebab1c19872d4.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F6540efafec428d7c41c8632c09457164&check=d1fa209eb6cddd57&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游20号更新首日，必做五件大事来袭！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8940d1a8eed210361.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F7863f895a4b868e28a26fbe3aec1dbc1&check=fc08effa3518ec0d&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游现脱坑潮，苏离吐槽增幅和新副本，怒喊策划别玩了",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c84ad0c88fb4424c0a.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F83e5426ba2b02fb7f3c50b75178cbf01&check=616cce6875480823&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游刀剑神域联动活动有哪些？联动详情介绍",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8b1f06775530683a2.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F9143f4a0fd176ffb3d1ff63d0b5f781e&check=fae10a2a13844391&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "DNF手游全职业7把隐藏武器免费领，获取流程一条龙！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8c028992743c6615d.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fcda75c27c87cc382369b44c2f31c6bbb&check=8029948339c878e4&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "全城沸腾！华为200家门店力挺诛仙2手游，这排面仙侠圈独一份！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c33013ee98087d35f5a61.png",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2F2d30712bb6993cbee91307851eb042ab&check=b36e62d48bfa1edf&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4 ",
    },
  ],
  枪战资讯: [
    {
      title: "和平精英：这3个冷门地点，物资竟如此丰富！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c871b377c371166c9d.jpg",
      url: "https://www.360kuai.com/988194c4c34c41f42?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "和平精英新手必知的3个进阶技巧，快速提升实力！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c837a6c30f8688e500.jpg",
      url: "https://www.360kuai.com/972d8d6384151ed4f?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66"
    },
    {
      title:
        "和平精英：大神和菜鸟的差距，究竟在哪里？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8f6f109d685be5b0e.jpg",
      url: "https://www.360kuai.com/9194496a4bc1e24b3?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "保时捷×和平精英跨界联动，声量上涨至900+",
      image:
      'https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8d5bd945d3dbc08ac.jpg',
      url: "https://www.360kuai.com/9c5c6c9a6e84606bc?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《和平精英》2025盛会亮点多，创新玩法引领游戏新风潮",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c898ad86c0cc73f7b9.jpg",
      url: "https://www.360kuai.com/99371c4728a9723ac?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66"
    },
    {
      title: "和平精英的跨界破圈营销：哪吒闹海、时尚芭莎",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8efcc0be549abc653.jpg",
      url: "https://www.360kuai.com/967777385d3963019?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66"
    },
    {
      title: "宋茜亮相和平精英刺激之夜 化身胜利女神逆转未来",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c3301fd324cc40b18338a.jpg",
      url: "https://www.360kuai.com/9fb3fe72d4c5fa95d?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "小丑女&小丑空降海岛！和平精英与DC联动引爆玩家整活创意",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8bbbab85a98448341.jpg",
      url: "https://www.360kuai.com/946c6dbb5203fbc7f?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66"
    },
    {
      title: "和平精英荣都大战场怎么玩？攻略来了！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8ca783d18680142b6.jpg",
      url: "https://www.360kuai.com/966f853a4d893addc?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "和平精英：同样是钢枪，为啥他总能赢？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c854987cfdcd78f251.jpg",
      url: "https://www.360kuai.com/901a92566bdb545cc?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
  ],
  原神: [
    {
      title: "原神：国产游戏走不出国门？有研发能力却不做！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8d6e9ce557b5c5ba1.jpg",
      url: "https://www.360kuai.com/90eeaabc476e55244?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神：游戏最后的乐趣，未被氪金“统治”的一片净土！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c822418cade5afa848.jpg",
      url: "https://www.360kuai.com/94ebb8fd2723f8fc8?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神新手速进！欧洛伦的五个误区，错过损失一个亿！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8b9cb0556d7a4fb06.jpg",
      url: "https://www.360kuai.com/9ffcc7bb8c1e611c4?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神：有人嫌游戏肝，策划无奈，竟是玩家“自找”！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c86528935587204412.jpg",
      url: "https://www.360kuai.com/922c02530a28fa1d5?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神新手速进！恶魔厨师爱可菲四大误区，暴力奶妈攻略在此",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8391294911b86d508.jpg",
      url: "https://www.360kuai.com/93d2604573d221cdf?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神新手必知！龙医生伊法误区与白衣天使，到底咋回事？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c82834a27d7f4c45ae.jpg",
      url: "https://www.360kuai.com/93194ed02e9a0cbd9?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《原神》基尼奇“零金”配队咋搞？四星角色组双绽放体系速看",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c87360c90f7f61bfc7.jpg",
      url: "https://www.360kuai.com/9c035d5f2c88e8c57?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "收藏！《原神》基尼奇“零金”配队，四星角色双绽放体系全攻略",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8b7e9e94e49291873.jpg",
      url: "https://www.360kuai.com/9828afdccd8c857ca?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神6.0卡池顺序巨变！两新岩五角色入池，五周年限定5星要送？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c855c57b41923f877c.jpg",
      url: "https://www.360kuai.com/9fcc655315e26839d?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《原神》四星角色连锁，平民玩家的制胜法宝？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c84bb4c67e904d9e4b.jpg",
      url: "https://www.360kuai.com/9270dd838f3eab8c4?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
  ],
  潜力资讯: [
    {
      title:
        "【原神】很难不支持！6.0首批老角色加强曝光！刻晴甘雨有望第2批",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c33015975ba3d151f335b.jpg",
      url: "https://www.360kuai.com/9796ff3f1d9b0838b?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神6.0卡池剧变！公子加强与菈乌玛立绘和谐，你咋看？",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c856a07e18f4c6a581.jpg",
      url: "https://www.360kuai.com/9776beef5361ebcb8?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "必看！原神6.0卡池大揭秘，公子加强、立绘与皮肤全解析",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c85b02b622b9ccfb00.jpg",
      url: "https://www.360kuai.com/97e54ab45b02f9269?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《合金装备Δ 食蛇者》评测：创新与守旧并存",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11fd4c330183d009534014c2fd.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fdc2e07a3c449530253659c33c82ef919&check=b8baac507d45a157&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
    {
      title: "原神6.0周年庆老角色加强，阿贝多绫华发型同步优化！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c888482a5fb079ee30.jpg",
      url: "https://www.360kuai.com/90accbbac709221ba?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神前期没五星玩不下去？这几个角色不满策划欲加强！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c843bfab73be855a11.jpg",
      url: "https://www.360kuai.com/99aff6a9ed8b6d33c?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神6.0福利来袭！原石增多十连常驻，送限定5星老角色加强",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8515c0b65149365d1.jpg",
      url: "https://www.360kuai.com/9aa8e6ddef889599d?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神：土豪专属氪金方式性价比低，普通玩家别碰！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c88617149b386141fc.jpg",
      url: "https://www.360kuai.com/91de87beed370793e?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神：不演了！6.0圣遗物新增优化！提前显示词条功能太香",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8ffb8733011202df6.jpg",
      url: "https://www.360kuai.com/9273da5554d53c771?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神后续可能不复刻五星角色，联机强却遭很多人看衰！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8f388edd1ef121b21.jpg",
      url: "https://www.360kuai.com/9f86123df8019d1cd?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神版本之子全能角色，各位置都能完美适配！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c879c542895dc0435f.jpg",
      url: "https://www.360kuai.com/pc/search?q=%E5%8E%9F%E7%A5%9E%E5%BC%BA%E5%8C%96&uid=e52b19ebe6abfdc03151f977be19fc66&sign=360_79aabe15&tj_url=9ce6993b5dede776f&scene=18007&tab=0"
    },
    {
      title: "原神最需策划救场的五星角色，不改版只能压箱底！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8669cfef04f7d1399.jpg",
      url: "https://www.360kuai.com/9fd098b059add9b4a?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神3个超模五星角色纵横大世界，最后一个绝了！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c84c11956a5d4f68ee.jpg",
      url: "https://www.360kuai.com/90c42bf8593ada2ff?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "原神基尼奇深度配队方案",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8aef286bf8ab900d9.jpg",
      url: "https://www.360kuai.com/982b66e00e346ec4a?sign=360_79aabe15&uid=e52b19ebe6abfdc03151f977be19fc66",
    },
    {
      title: "《原神》那些潜力角色，玩家现在不养太浪费！",
      image:
        "https://p0.ssl.img.360kuai.com/dmfd/183_114_/t11508c75c8a493e973c742d618.jpg",
      url: "https://www.360kuai.com/pc/detail?url=http%3A%2F%2Fzm.news.so.com%2Fb3ddb196e0aa5afd3c1fb16a9caa991c&check=4dc550ca71903e97&sign=360_da20e874&uid=1356afe622903431a7230adf3a18f9b4",
    },
  ],
};
const scrollViewRef = ref("");
const cateTabs = (tab) => {
  activeTab.value = tab;
  uni.pageScrollTo({
    scrollTop: 0,
    duration: 300, // 动画持续时间，单位ms
  });
};
const filteredNews = computed(() => {
  return allNews[activeTab.value] || [];
});

const navSearch = () => {
  uni.navigateTo({
    url: "/pages/search/index",
  });
};

const handleTabChange = (index) => {
  currentTabIndex.value = index;
  tabbarTo(index);
};

const navWeb = (item) => {
  uni.navigateTo({
    url: "/pages/search/webView?url=" + encodeURIComponent(item.url),
  });
};
const onScrollToLower = () => {
  showToast("今日已没有更多新闻了");
};
</script>

<style scoped>
.news-page-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #ffffff;
}

/* 顶部导航栏 */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20rpx 30rpx;
  background-color: #4caf50; /* Green background */
  height: 60rpx;
}
.nav-left {
  display: flex;
  align-items: center;
  color: white;
}
.nav-icon {
  width: 40rpx;
  height: 40rpx;
  margin-right: 15rpx;
}
.nav-title {
  font-size: 32rpx;
  font-weight: 600;
  color: #eee;
}
.nav-search-icon {
  width: 40rpx;
  height: 40rpx;
}
/* 分类标签栏 */
.category-tabs {
  display: flex;
  padding: 0 30rpx;
  background-color: #4caf50;
  flex-shrink: 0;
  overflow-x: auto;
}
.tab-item {
  padding: 20rpx 15rpx;
  margin-right: 20rpx;
  font-size: 28rpx;
  color: #e0e0e0;
  border-bottom: 4rpx solid transparent;
  /* text-wrap: nowrap; */
  white-space: nowrap;
}
.tab-item.active {
  color: #ffffff;
  font-weight: bold;
  border-bottom-color: #ffffff;
}

/* 新闻列表 */
.news-list {
  flex: 1;
  padding: 0 30rpx;
  background-color: #fff;
  height: 0; /*  配合flex:1实现内容区域滚动 */
  width: 92%;
}
.news-item {
  display: flex;
  align-items: center;
  padding: 20rpx 0;
  border-bottom: 1px solid #f5f5f5;
}
.news-thumbnail {
  width: 180rpx;
  height: 120rpx;
  border-radius: 10rpx;
  margin-right: 20rpx;
  flex-shrink: 0;
}
.news-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
}
.news-title {
  font-size: 30rpx;
  color: #333;
  font-weight: 500;
  /* 多行省略，如果需要 */
  /* display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden; */
}
.news-comment-icon {
  width: 32rpx;
  height: 32rpx;
  margin-top: 10rpx;
  align-self: flex-start;
}

.tabbar-placeholder {
  height: 100rpx;
  flex-shrink: 0;
}
</style>
